<html>
  <head>
    <title>Using WatermarkInputPromptManager</title>
    <link rel="stylesheet" type="text/css" href="../../styles/presentation.css" />
    <link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" />
    <script type="text/javascript" src="../../scripts/EventUtilities.js"></script>
    <script type="text/javascript" src="../../scripts/SplitScreen.js"></script>
    <script type="text/javascript" src="../../scripts/Dropdown.js"></script>
    <script type="text/javascript" src="../../scripts/script_loc.js"></script>
    <script type="text/javascript" src="../../scripts/script_manifold.js"></script>
    <script type="text/javascript" src="../../scripts/script_feedBack.js"></script>
    <script type="text/javascript" src="../../scripts/CheckboxMenu.js"></script>
    <script type="text/javascript" src="../../scripts/CommonUtilities.js"></script>
  </head>
  <body>
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="../../icons/collapse_all.gif" title="Collapse image" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="../../icons/expand_all.gif" title="Expand Image" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="../../icons/collapse_all.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="../../icons/expand_all.gif" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="../../icon/dropdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="../../icons/dropdownHover.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="../../icons/copycode.gif" title="Copy image" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="../../icons/copycodeHighlight.gif" title="CopyHover image" />
    <div id="header">
      <table id="topTable" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage, event)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="../../icons/collapse_all.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">Collapse All</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">Expand All</label>
            </span>
          </td>
        </tr>
      </table>
      <table id="bottomTable" cellpadding="0" cellspacing="0">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DevExpress Contrib</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">
                  Using WatermarkInputPromptManager
               </span>
          </td>
          <td align="center" style="width: 1px; padding: 0px">
            <img src="../../images/DevExContrib 32.png" alt="DevExpress Contrib" />
          </td>
        </tr>
        <tr id="headerTableRow3">
          <td align="left">
            <span id="headfb" class="feedbackhead" />
          </td>
        </tr>
      </table>
      <table id="gradientTable">
        <tr>
          <td class="nsrBottom" background="../../icons/gradient.gif" />
        </tr>
      </table>
    </div>
    <div id="mainSection">
      <div id="mainBody">
        <div class="Content">
            <p>At it's simplest, instantiate an instance of the WatermarkInputPromptManager, and add a
            valid BaseEdit control with a prompt.</p>
          <pre lang="cs" numberLines="true" outlining="true" title="Simplest Example of WatermarkInputPromptManager">
   private WatermarkInputPromptManager watermarkManager;

   public TestForm()
   {
      InitializeComponent();
      watermarkManager = new WatermarkInputPromptManager();
      watermarkManager.Add(textEdit, "Required");
   }</pre>
         <p>This will place the word &quot;Required&quot; into the TextEdit control as an input prompt.
         The input prompt will be in SystemColors.GrayText. The normal text will be shown in SystemColors.ControlText.
         </p>
         <p>To modify the default colors instantiate an instance of WatermarkInputPromptManager with the new
         default colors</p>
         <pre lang="cs" numberLines="true" outlining="true" title="Modifying the default colors">
   watermarkManager = new WatermarkInputPromptManager(Color.Plum, Color.Empty);</pre>

         <p>This will make the input prompt color Plum and leave the control text color SystemColors.ControlText.
         Passing Color.Empty into either of the two parameters will keep the standard default color.</p>
         <p>To change the default behavior of logging, localization and configuration you can set the IServicesHelper
         to your own implementation.</p>
         <pre lang="cs" numberLines="true" outlining="true" title="Using a custom IServicesHelper">
   watermarkManager = new WatermarkInputPromptManager(new MyCustomServicesHelper());</pre>
         <p>The WatermarkInputPromptManager default behavior is to ignore BaseEdit descendants which are invalid.
         However, if you want to throw an exception instead, you can set the property ThrowExceptionWhenAddingInvalidControl
         to true. This would be appropriate during debug mode to prevent a developer from adding an inappropriate BaseEdit
         descendant.</p>
         <p>You can also change the colors of individual controls added to the WatermarkInputPromptManager.</p>
         <pre lang="cs" numberLines="true" outlining="true" title="Modifying the default colors of an individual control">
   watermarkManager = new WatermarkInputPromptManager();
   // use the default colors
   watermarkManager.Add(buttonEdit, "Required");
   // use custom colors for this one control
   watermarkManager.Add(textEdit, "Required", Color.Plum, Color.Red);</pre>
         <b>Notes:</b>
         <ul>
            <li>Adding controls to the WatermarkInputPromptManager should be done after InitializeComponent() but
            before the form has been shown.</li>
            <li>If you change the default colors programmatically after the form has been shown, the controls will
            not reflect this change until the control Enter and Leave events have been called.</li>
            <li>The BaseEdit ControlCustomDisplayText event is not fired if the control is attached to a DxValidationProvider.
            The proper behavior can be forced by setting the AllowWatermarksWithDxValidationProviderKludge property
            to true.</li>
         </ul>
         <p>&nbsp;</p>
         <p>
            <a href="Task-Based Help.html">Back to task-based help.</a>
         </p>
        </div>
      </div>
      <div id="footer">
        <div class="footerLine">
          <img width="100%" height="3px" src="../../icons/footer.gif" title="Footer image" />
        </div>
        <p />
        <div id="DevLynxVersion">
           <p><small>v2009.0.3332.39062 (2009-02-14  21:42:04)</small></p>
        </div>
        <div id="DevLynxCopyright">
           <p>Copyright &copy; 2008-2009, DevLynx</p>
        </div>
      </div>
    </div>
  </body>
</html>
<!-- @SortOrder 8 -->
